var beiMiCommon = require("BeiMiCommon");
cc.Class({
    extends: beiMiCommon,

    properties: {
        // foo: {
        //    default: null,      // The default value will be used only when the component attaching
        //                           to a node for the first time
        //    url: cc.Texture2D,  // optional, default is typeof default
        //    serializable: true, // optional, default is true
        //    visible: true,      // optional, default is true
        //    displayName: 'Foo', // optional
        //    readonly: false,    // optional, default is false
        // },
        // ...
        roomidDialog: {
            default: null,
            type: cc.Prefab
        },
        roomidCreate:{
            default: null,
            type: cc.Prefab
        },
        mjCreate:{
            default: null,
            type: cc.Prefab
        }
    },

    // use this for initialization
    onLoad: function () {

    },
    onClick:function(event, data){
        this.loadding();
        let object = this ;
        setTimeout(function(){
            object.scene(data , object) ;
        } , 200);
    },
    onClickJoinRoom:function(){
        //创建房间id弹窗
        if(this.roomidDialog){
            cc.beimi.openwin = cc.instantiate(this.roomidDialog) ;
            cc.beimi.openwin.parent = this.root();//基于根节点
        }
    },
    onClickCreateRoom:function(event, type){
        console.log(type)
        cc.beimi.roomType = type;
        //创建房间id弹窗
        if(this.roomidDialog){
            if(type==1){
                cc.beimi.openwin = cc.instantiate(this.roomidCreate) ;
                cc.beimi.openwin.parent = this.root();//基于根节点
            }
            else{
                cc.beimi.openwin = cc.instantiate(this.mjCreate) ;
                cc.beimi.openwin.parent = this.root();//基于根节点
            }
        }
    }

    // called every frame, uncomment this function to activate update callback
    // update: function (dt) {

    // },
});
